/*
 * File:   DieServiceImplTest.cpp
 * Author: luk
 *
 * Created on Mar 1, 2015, 12:55:22 PM
 */

#include "DieServiceImplTest.h"
#include "DieServiceImpl.h"
#include <sstream>

CPPUNIT_TEST_SUITE_REGISTRATION(DieServiceImplTest);

DieServiceImplTest::DieServiceImplTest() {
}

DieServiceImplTest::~DieServiceImplTest() {
}

void DieServiceImplTest::setUp() {
}

void DieServiceImplTest::tearDown() {
}

void DieServiceImplTest::test1dRoll() {
    DieServiceImpl dieServiceImpl;

    for (int i = 0; i < 1000; i++) {
        int result = dieServiceImpl.roll(1);

        std::stringstream message;
        message << "Expected roll [1-6] but was " << result;

        CPPUNIT_ASSERT_MESSAGE(message.str(), 1 <= result && result <= 6);
    }
}

void DieServiceImplTest::test3dRoll() {
    DieServiceImpl dieServiceImpl;

    for (int i = 0; i < 1000; i++) {
        int result = dieServiceImpl.roll(3);

        std::stringstream message;
        message << "Expected roll [3-18] but was " << result;

        CPPUNIT_ASSERT_MESSAGE(message.str(), 3 <= result && result <= 18);
    }
}

